/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package gamedsl2.util;

import gamedsl2.*;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see gamedsl2.Gamedsl2Package
 * @generated
 */
public class Gamedsl2Switch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static Gamedsl2Package modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Gamedsl2Switch() {
		if (modelPackage == null) {
			modelPackage = Gamedsl2Package.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case Gamedsl2Package.ENVIRONMENT: {
				Environment environment = (Environment)theEObject;
				T result = caseEnvironment(environment);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.ABSTRACT_ENVIRONMENT: {
				AbstractEnvironment abstractEnvironment = (AbstractEnvironment)theEObject;
				T result = caseAbstractEnvironment(abstractEnvironment);
				if (result == null) result = caseEnvironment(abstractEnvironment);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.TILE_ENVIRONMENT: {
				TileEnvironment tileEnvironment = (TileEnvironment)theEObject;
				T result = caseTileEnvironment(tileEnvironment);
				if (result == null) result = caseAbstractEnvironment(tileEnvironment);
				if (result == null) result = caseEnvironment(tileEnvironment);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.ENTITY: {
				Entity entity = (Entity)theEObject;
				T result = caseEntity(entity);
				if (result == null) result = caseIEventHandler(entity);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.ABSTRACT_ENTITY: {
				AbstractEntity abstractEntity = (AbstractEntity)theEObject;
				T result = caseAbstractEntity(abstractEntity);
				if (result == null) result = caseEntity(abstractEntity);
				if (result == null) result = caseIEventHandler(abstractEntity);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.ACTOR_PHYSICS: {
				ActorPhysics actorPhysics = (ActorPhysics)theEObject;
				T result = caseActorPhysics(actorPhysics);
				if (result == null) result = caseAbstractEntity(actorPhysics);
				if (result == null) result = caseEntity(actorPhysics);
				if (result == null) result = caseIEventHandler(actorPhysics);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.TILE: {
				Tile tile = (Tile)theEObject;
				T result = caseTile(tile);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.TILE_SHAPES: {
				TileShapes tileShapes = (TileShapes)theEObject;
				T result = caseTileShapes(tileShapes);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.GAME_HOLDER: {
				GameHolder gameHolder = (GameHolder)theEObject;
				T result = caseGameHolder(gameHolder);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.STATE: {
				State state = (State)theEObject;
				T result = caseState(state);
				if (result == null) result = caseIEventHandler(state);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.MAP_LOADER: {
				MapLoader mapLoader = (MapLoader)theEObject;
				T result = caseMapLoader(mapLoader);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.RECTANGULAR_ENTITY: {
				RectangularEntity rectangularEntity = (RectangularEntity)theEObject;
				T result = caseRectangularEntity(rectangularEntity);
				if (result == null) result = caseAbstractEntity(rectangularEntity);
				if (result == null) result = caseEntity(rectangularEntity);
				if (result == null) result = caseIEventHandler(rectangularEntity);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.ACTOR_GAME: {
				ActorGame actorGame = (ActorGame)theEObject;
				T result = caseActorGame(actorGame);
				if (result == null) result = caseActorPhysics(actorGame);
				if (result == null) result = caseAbstractEntity(actorGame);
				if (result == null) result = caseEntity(actorGame);
				if (result == null) result = caseIEventHandler(actorGame);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.TILE_SET: {
				TileSet tileSet = (TileSet)theEObject;
				T result = caseTileSet(tileSet);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.EVENT: {
				Event event = (Event)theEObject;
				T result = caseEvent(event);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.IEVENT_HANDLER: {
				IEventHandler iEventHandler = (IEventHandler)theEObject;
				T result = caseIEventHandler(iEventHandler);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.EVENT_TRACKER: {
				EventTracker eventTracker = (EventTracker)theEObject;
				T result = caseEventTracker(eventTracker);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case Gamedsl2Package.SPRITE: {
				Sprite sprite = (Sprite)theEObject;
				T result = caseSprite(sprite);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Environment</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Environment</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEnvironment(Environment object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Abstract Environment</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Abstract Environment</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseAbstractEnvironment(AbstractEnvironment object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Tile Environment</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Tile Environment</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTileEnvironment(TileEnvironment object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Entity</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Entity</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEntity(Entity object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Abstract Entity</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Abstract Entity</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseAbstractEntity(AbstractEntity object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Actor Physics</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Actor Physics</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseActorPhysics(ActorPhysics object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Tile</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Tile</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTile(Tile object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Tile Shapes</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Tile Shapes</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTileShapes(TileShapes object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Game Holder</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Game Holder</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseGameHolder(GameHolder object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>State</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>State</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseState(State object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Map Loader</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Map Loader</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMapLoader(MapLoader object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Rectangular Entity</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Rectangular Entity</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseRectangularEntity(RectangularEntity object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Actor Game</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Actor Game</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseActorGame(ActorGame object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Tile Set</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Tile Set</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTileSet(TileSet object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Event</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Event</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEvent(Event object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IEvent Handler</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IEvent Handler</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIEventHandler(IEventHandler object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Event Tracker</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Event Tracker</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEventTracker(EventTracker object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Sprite</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Sprite</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseSprite(Sprite object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //Gamedsl2Switch
